
'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;
  const auth = app.middleware.auth({},app);

  router.get('/', controller.home.index);
  router.get('/captcha',controller.home.captcha);
  //router.get('/checkCaptcha',controller.home.checkCaptcha);
  router.get('/api/getResources',controller.role.getResources);
  router.post('/api/setResources',controller.role.setResources);
  router.get('/api/getUsers',controller.role.getUsers);
  router.post('/api/setUsers',controller.role.setUsers);
  router.resources('user','/api/user',controller.user);
  router.resources('resource','/api/resource',controller.resource);
  router.resources('role','/api/role',controller.role);
  router.resources('roleResource','/api/roleResource',controller.roleResource);
  router.resources('roleUser','/api/roleUser',controller.roleUser);

  router.post('/api/signup', controller.user.signup);
  router.post('/api/login', controller.user.login);
};
